﻿@model S4Store.Models.Report.CarModelHistoryModel
@{
    Layout = null;
    var container = "div" + Guid.NewGuid().ToString();
    var tiems = new List<String>();
    var ddsls = new List<String>();
    var ddmbs = new List<String>();
    var xstcs = new List<String>();
    var xsmbs = new List<String>();
    Model.Reports.ForEach(t => tiems.Add("\"" + t.Year + "-" + t.Month + "\""));
    Model.Reports.ForEach(t => ddsls.Add(t.OrderCount.ToString()));
    Model.Reports.ForEach(t => xstcs.Add(t.GiveCarCount.ToString()));
    Model.Reports.ForEach(t => xsmbs.Add(t.SaleTarget.ToString()));
    Model.Reports.ForEach(t => ddmbs.Add(t.OrderTarget.ToString()));
}
<div style="height:100%; overflow:auto">

<div style=" width:100%; height:30px; background:#E5EDEF">
    <div style=" padding:0 10px">
        <form action="@Url.Action("CarModelHistory", "Report")">
        @if (Model.ShowStore)
        {
        <select class="storechooser" name="StoreId">
            @foreach (var store in Model.BarModel.Stores)
            {
                <option  value="@store.Id" @if (Model.BarModel.Store != null && store.Id == Model.BarModel.Store.Id)
                                           {<text>selected="selected"</text>}>@store.Name</option>
            }
        </select>
        }
        <select name="SearchCarModelId">
            <option value="0">@(Model.CarBrandName)全车型</option>
            @foreach (var m in Model.CarModels)
            {
                <option value="@m.Id" @if (Model.CarModelId == m.Id)
                                      {<text>selected="selected"</text>}>@m.Name</option>
            }
        </select>
        <input type="hidden" name="SearchCarBrandId" value="@Model.CarBrandId" />
            @Html.Partial("YmSeleter", new S4Store.Models.YmList { Start = new DateTime(2013,1,1), End = DateTime.Now, Current = Model.BarModel.Start, Name = "Start" })
            -
            @Html.Partial("YmSeleter", new S4Store.Models.YmList { Start = new DateTime(2013, 1, 1), End = DateTime.Now, Current = Model.BarModel.End, Name = "End" })
          <input type="button" value="查询" class="reportsubmit" />
        </form>
    </div>
</div>
<div style="position:relative; width:100%" id="@container">
        
</div>

<script type="text/javascript">
   
        $('#@container').highcharts({
            chart: {
                type: 'line'
            },
            title: {
                text: '销售台次历史记录'
            },
            xAxis: {
                categories: [ @Html.Raw(String.Join(",", tiems))]
            },
            yAxis: {
                title: {
                    text: '数量'
                }
            },
            tooltip: {
                enabled: true,
                formatter: function () {
                    return '<b>' + this.series.name + '</b><br/>' +
                        this.x + ': ' + this.y ;
                }
            },
            plotOptions: {
                line: {
                    dataLabels: {
                        enabled: true
                    }
                }
            },
            series: [{
                name: '订单数量',
                data: [@(String.Join(",", ddsls))]
            },{
                name: '订单目标',
                data: [@(String.Join(",", ddmbs))]
            }, {
                name: '销售台次',
                data: [@(String.Join(",", xstcs))]
            }, {
                name: '销售目标',
                data: [@(String.Join(",", xsmbs))]
            }]
        });

    

		</script>
        
</div>